Optimal. Leaf size=273 \[ \frac {\, _2F_1\left (1,1+n;2+n;\frac {c+d \tan (e+f x)}{c-i d}\right ) (c+d \tan (e+f x))^{1+n}}{8 a^2 (i c+d) f (1+n)}+\frac {\left (c^2+2 i c d (1-n)-d^2 \left (1-4 n+2 n^2\right )\right ) \, _2F_1\left (1,1+n;2+n;\frac {c+d \tan (e+f x)}{c+i d}\right ) (c+d \tan (e+f x))^{1+n}}{8 a^2 (i c-d)^3 f (1+n)}+\frac {(i c-d (2-n)) (c+d \tan (e+f x))^{1+n}}{4 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {(c+d \tan (e+f x))^{1+n}}{4 (i c-d) f (a+i a \tan (e+f x))^2} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.38, antiderivative size = 273, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {3640, 3677,
3620, 3618, 70} \begin {gather*} \frac {\left (c^2+2 i c d (1-n)-d^2 \left (2 n^2-4 n+1\right )\right ) (c+d \tan (e+f x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {c+d \tan (e+f x)}{c+i d}\right )}{8 a^2 f (n+1) (-d+i c)^3}+\frac {(c+d \tan (e+f x))^{n+1} \, _2F_1\left (1,n+1;n+2;\frac {c+d \tan (e+f x)}{c-i d}\right )}{8 a^2 f (n+1) (d+i c)}+\frac {(-d (2-n)+i c) (c+d \tan (e+f x))^{n+1}}{4 a^2 f (c+i d)^2 (1+i \tan (e+f x))}-\frac {(c+d \tan (e+f x))^{n+1}}{4 f (-d+i c) (a+i a \tan (e+f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 70
Rule 3618
Rule 3620
Rule 3640
Rule 3677
Rubi steps
\begin {align*} \int \frac {(c+d \tan (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx &=-\frac {(c+d \tan (e+f x))^{1+n}}{4 (i c-d) f (a+i a \tan (e+f x))^2}-\frac {\int \frac {(c+d \tan (e+f x))^n (-a (2 i c-d (3-n))-i a d (1-n) \tan (e+f x))}{a+i a \tan (e+f x)} \, dx}{4 a^2 (i c-d)}\\ &=\frac {(i c-d (2-n)) (c+d \tan (e+f x))^{1+n}}{4 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {(c+d \tan (e+f x))^{1+n}}{4 (i c-d) f (a+i a \tan (e+f x))^2}-\frac {\int (c+d \tan (e+f x))^n \left (-2 a^2 \left (c^2-d^2 (1-n)^2+i c d (2-n)\right )+2 a^2 d (c+i d (2-n)) n \tan (e+f x)\right ) \, dx}{8 a^4 (c+i d)^2}\\ &=\frac {(i c-d (2-n)) (c+d \tan (e+f x))^{1+n}}{4 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {(c+d \tan (e+f x))^{1+n}}{4 (i c-d) f (a+i a \tan (e+f x))^2}+\frac {\int (1+i \tan (e+f x)) (c+d \tan (e+f x))^n \, dx}{8 a^2}+\frac {\left (c^2+2 i c d (1-n)-d^2 \left (1-4 n+2 n^2\right )\right ) \int (1-i \tan (e+f x)) (c+d \tan (e+f x))^n \, dx}{8 a^2 (c+i d)^2}\\ &=\frac {(i c-d (2-n)) (c+d \tan (e+f x))^{1+n}}{4 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {(c+d \tan (e+f x))^{1+n}}{4 (i c-d) f (a+i a \tan (e+f x))^2}+\frac {i \text {Subst}\left (\int \frac {(c-i d x)^n}{-1+x} \, dx,x,i \tan (e+f x)\right )}{8 a^2 f}+\frac {\left (2 c d (1-n)-i \left (c^2-d^2 \left (1-4 n+2 n^2\right )\right )\right ) \text {Subst}\left (\int \frac {(c+i d x)^n}{-1+x} \, dx,x,-i \tan (e+f x)\right )}{8 a^2 (c+i d)^2 f}\\ &=\frac {\, _2F_1\left (1,1+n;2+n;\frac {c+d \tan (e+f x)}{c-i d}\right ) (c+d \tan (e+f x))^{1+n}}{8 a^2 (i c+d) f (1+n)}+\frac {\left (c^2+2 i c d (1-n)-d^2 \left (1-4 n+2 n^2\right )\right ) \, _2F_1\left (1,1+n;2+n;\frac {c+d \tan (e+f x)}{c+i d}\right ) (c+d \tan (e+f x))^{1+n}}{8 a^2 (i c-d)^3 f (1+n)}+\frac {(i c-d (2-n)) (c+d \tan (e+f x))^{1+n}}{4 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac {(c+d \tan (e+f x))^{1+n}}{4 (i c-d) f (a+i a \tan (e+f x))^2}\\ \end {align*}
________________________________________________________________________________________
Mathematica [F]
time = 8.13, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {(c+d \tan (e+f x))^n}{(a+i a \tan (e+f x))^2} \, dx \end {gather*}
Verification is not applicable to the result.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 3.48, size = 0, normalized size = 0.00 \[\int \frac {\left (c +d \tan \left (f x +e \right )\right )^{n}}{\left (a +i a \tan \left (f x +e \right )\right )^{2}}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - \frac {\int \frac {\left (c + d \tan {\left (e + f x \right )}\right )^{n}}{\tan ^{2}{\left (e + f x \right )} - 2 i \tan {\left (e + f x \right )} - 1}\, dx}{a^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int \frac {{\left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )}^n}{{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^2} \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________